using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class vkPsdetMap : EntityTypeConfiguration<vkPsdet>
    {
        public vkPsdetMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Invoice_Number, t.Invoice_Date, t.Sale_Type, t.Document_Type, t.POSTED });

            // Properties
            this.Property(t => t.Selling_Currency)
                .HasMaxLength(20);

            this.Property(t => t.Store)
                .HasMaxLength(30);

            this.Property(t => t.Register)
                .HasMaxLength(30);

            this.Property(t => t.Invoice_Number)
                .IsRequired()
                .HasMaxLength(8);

            this.Property(t => t.Invoice_Time)
                .HasMaxLength(5);

            this.Property(t => t.Sale_Type)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Document_Type)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Customer_Name)
                .HasMaxLength(35);

            this.Property(t => t.Order_Number)
                .HasMaxLength(8);

            this.Property(t => t.Quote_Number)
                .HasMaxLength(8);

            this.Property(t => t.Item_Number)
                .HasMaxLength(10);

            this.Property(t => t.SALES_MAN)
                .HasMaxLength(30);

            this.Property(t => t.Salesman_Region)
                .HasMaxLength(5);

            this.Property(t => t.Cash_Account_Number)
                .HasMaxLength(40);

            this.Property(t => t.Customer_Phone)
                .HasMaxLength(20);

            this.Property(t => t.Product)
                .HasMaxLength(250);

            this.Property(t => t.CITY)
                .HasMaxLength(30);

            this.Property(t => t.STATE)
                .HasMaxLength(3);

            this.Property(t => t.REGION)
                .HasMaxLength(5);

            // Table & Column Mappings
            this.ToTable("vkPsdet");
            this.Property(t => t.Selling_Currency).HasColumnName("Selling Currency");
            this.Property(t => t.Store).HasColumnName("Store");
            this.Property(t => t.Register).HasColumnName("Register");
            this.Property(t => t.Invoice_Number).HasColumnName("Invoice Number");
            this.Property(t => t.Invoice_Date).HasColumnName("Invoice Date");
            this.Property(t => t.Invoice_Time).HasColumnName("Invoice Time");
            this.Property(t => t.Invoice_Total).HasColumnName("Invoice Total");
            this.Property(t => t.Invoice_Cost).HasColumnName("Invoice Cost");
            this.Property(t => t.Returned_Money).HasColumnName("Returned Money");
            this.Property(t => t.Sale_Type).HasColumnName("Sale Type");
            this.Property(t => t.Document_Type).HasColumnName("Document Type");
            this.Property(t => t.Customer_Name).HasColumnName("Customer Name");
            this.Property(t => t.Order_Number).HasColumnName("Order Number");
            this.Property(t => t.Quote_Number).HasColumnName("Quote Number");
            this.Property(t => t.Delivery_Date).HasColumnName("Delivery Date");
            this.Property(t => t.Trading_Type).HasColumnName("Trading Type");
            this.Property(t => t.Discount_Amount).HasColumnName("Discount Amount");
            this.Property(t => t.Total_Discounted_Invoice).HasColumnName("Total Discounted Invoice");
            this.Property(t => t.Item_Number).HasColumnName("Item Number");
            this.Property(t => t.Item_Quantity).HasColumnName("Item Quantity");
            this.Property(t => t.Total_Item_Amount).HasColumnName("Total Item Amount");
            this.Property(t => t.Item_Cost).HasColumnName("Item Cost");
            this.Property(t => t.DEBIT).HasColumnName("DEBIT");
            this.Property(t => t.Item_Serial_Number).HasColumnName("Item Serial Number");
            this.Property(t => t.Item_Price).HasColumnName("Item Price");
            this.Property(t => t.Item_Discount_Percentage).HasColumnName("Item Discount Percentage");
            this.Property(t => t.Discount_Value).HasColumnName("Discount Value");
            this.Property(t => t.Discounted_Total_Item).HasColumnName("Discounted Total Item");
            this.Property(t => t.Expiry_Date).HasColumnName("Expiry Date");
            this.Property(t => t.SALES_MAN).HasColumnName("SALES MAN");
            this.Property(t => t.Salesman_Region).HasColumnName("Salesman Region");
            this.Property(t => t.POSTED).HasColumnName("POSTED");
            this.Property(t => t.Cash_Account_Number).HasColumnName("Cash Account Number");
            this.Property(t => t.Expected_Delivery_Date).HasColumnName("Expected Delivery Date");
            this.Property(t => t.Customer_Phone).HasColumnName("Customer Phone");
            this.Property(t => t.Profit).HasColumnName("Profit");
            this.Property(t => t.Product).HasColumnName("Product");
            this.Property(t => t.CATEGORY).HasColumnName("CATEGORY");
            this.Property(t => t.CITY).HasColumnName("CITY");
            this.Property(t => t.STATE).HasColumnName("STATE");
            this.Property(t => t.REGION).HasColumnName("REGION");
        }
    }
}
